package com.onlyphoto.onlymall.api

import com.onlyphoto.onlymall.base.BaseEntity
import com.onlyphoto.onlymall.base.BaseNetworkResponse
import com.onlyphoto.onlymall.bean.ShopBean
import com.onlyphoto.onlymall.bean.TabbarListBean
import com.onlyphoto.onlymall.bean.request.*
import com.onlyphoto.onlymall.bean.response.*
import io.reactivex.Observable
import okhttp3.RequestBody
import retrofit2.http.*

/**
 * Created by gaochujia on 2019-06-28.
 */
interface ApiService {

    @GET
    fun rotation(@retrofit2.http.Url requestUrl: String, @Query("use_range")use_range: Int): Observable<BaseNetworkResponse<ArrayList<Rotation>>>

    @GET
    fun requestMain(@retrofit2.http.Url requestUrl: String): Observable<BaseNetworkResponse<TabbarListBean>>

    @GET
    fun singleActivity(@retrofit2.http.Url requestUrl: String, @Query("use_range")use_range: Int, @Query("range_cat1_id")range_cat1_id: Int): Observable<BaseNetworkResponse<SingleActivityBean>>

    @GET
    fun goods(@retrofit2.http.Url requestUrl: String, @QueryMap condition: Map<String, String>): Observable<BaseNetworkResponse<ArrayList<GoodsBean>>>

    @GET
    fun category(@retrofit2.http.Url requestUrl: String, @Query("grade")grade : Int, @Query("up_id")up_id: String): Observable<BaseNetworkResponse<ArrayList<CategoryBean>>>

    @GET
    fun getVerify(@retrofit2.http.Url requestUrl: String, @Query("get_type")get_type : Int, @Query("phone")phone: String): Observable<BaseNetworkResponse<Void>>

    @FormUrlEncoded
    @POST
    fun loginBySms(@retrofit2.http.Url requestUrl: String, @FieldMap smsMap: Map<String, String>): Observable<BaseNetworkResponse<UserInfoBean>>

    @FormUrlEncoded
    @POST
    fun setPwd(@retrofit2.http.Url requestUrl: String, @FieldMap pwdMap: Map<String, String>): Observable<BaseNetworkResponse<BaseEntity>>

    @FormUrlEncoded
    @POST
    fun updatePwd(@retrofit2.http.Url requestUrl: String, @FieldMap pwdMap: Map<String, String>): Observable<BaseNetworkResponse<BaseEntity>>

    @FormUrlEncoded
    @POST
    fun resetPwd(@retrofit2.http.Url requestUrl: String, @FieldMap pwdMap: Map<String, String>): Observable<BaseNetworkResponse<Void>>

    @FormUrlEncoded
    @POST
    fun loginByPwd(@retrofit2.http.Url requestUrl: String, @FieldMap loginMap: Map<String, String>): Observable<BaseNetworkResponse<UserInfoBean>>

    @FormUrlEncoded
    @POST
    fun loginByWx(@retrofit2.http.Url requestUrl: String, @Field("user_info")user_info: String): Observable<BaseNetworkResponse<UserInfoBean>>

    @GET
    fun order(@retrofit2.http.Url requestUrl: String, @Query("get_type")get_type: Int, @Query("state")state: Int, @Query("page_num")page_num: Int): Observable<BaseNetworkResponse<ArrayList<OrderBean>>>

    @GET
    fun shoppingCart(@retrofit2.http.Url requestUrl: String): Observable<BaseNetworkResponse<ArrayList< ShopBean>>>

    @PUT
    fun shoppingCartUpdate(@retrofit2.http.Url requestUrl: String, @Body bean: UpdateShopBean): Observable<BaseNetworkResponse<BaseEntity>>

    @HTTP(method = "DELETE", hasBody = true)
    fun shoppingCartDelete(@retrofit2.http.Url requestUrl: String, @Body bean: ShopCartDeleteBean): Observable<BaseNetworkResponse<BaseEntity>>

    @FormUrlEncoded
    @POST
    fun addAddress(@retrofit2.http.Url requestUrl: String, @FieldMap goodsMap: Map<String, String>): Observable<BaseNetworkResponse<BaseEntity>>

    @PUT
    fun updateAddress(@retrofit2.http.Url requestUrl: String, @Body bean: AddressAddBean): Observable<BaseNetworkResponse<BaseEntity>>

    @HTTP(method = "DELETE", hasBody = true)
    fun deleteAddress(@retrofit2.http.Url requestUrl: String, @Body bean: DeleteAddressBean): Observable<BaseNetworkResponse<BaseEntity>>

    @GET
    fun userAddress(@retrofit2.http.Url requestUrl: String): Observable<BaseNetworkResponse<ArrayList<AddressBean>>>

    @GET
    fun region(@retrofit2.http.Url requestUrl: String, @Query("layout")layout: Int): Observable<BaseNetworkResponse<RegionBean2>>

    @GET
    fun topSearch(@retrofit2.http.Url requestUrl: String): Observable<BaseNetworkResponse<ArrayList<String>>>

    @GET
    fun goodsDetials(@retrofit2.http.Url requestUrl: String, @Query("goods_id")goods_id: Int): Observable<BaseNetworkResponse<GoodsDetailsBean>>

    @FormUrlEncoded
    @POST
    fun addToCart(@retrofit2.http.Url requestUrl: String, @FieldMap goodsMap: Map<String, String>): Observable<BaseNetworkResponse<BaseEntity>>

    @GET
    fun getStoreCoupons(@retrofit2.http.Url requestUrl: String, @Query("get_type")get_type: Int): Observable<BaseNetworkResponse<ArrayList<CouponBean>>>

    @GET
    fun getUserCoupons(@retrofit2.http.Url requestUrl: String, @Query("get_type")get_type: Int, @Query("state")state: Int): Observable<BaseNetworkResponse<ArrayList<CouponBean>>>

    @FormUrlEncoded
    @POST
    fun receiveCoupon(@retrofit2.http.Url requestUrl: String, @Field("voucherl_id")voucherl_id: Int, @Field("end_tm")end_tm: Long): Observable<BaseNetworkResponse<BaseEntity>>

    @GET
    fun getOrderDetails(@retrofit2.http.Url requestUrl: String, @Query("get_type")get_type: Int, @Query("order_id")order_id: Int): Observable<BaseNetworkResponse<OrderDetailsBean>>

    @PUT
    fun confrimReceive(@retrofit2.http.Url requestUrl: String, @Body bean: ConfirmReceiveBean): Observable<BaseNetworkResponse<BaseEntity>>

    @PUT
    fun refund(@retrofit2.http.Url requestUrl: String, @Body bean: RefundBean): Observable<BaseNetworkResponse<BaseEntity>>

    @GET
    fun getRefundInfo(@retrofit2.http.Url requestUrl: String, @Query("get_type")get_type: Int, @Query("order_id")order_id: String): Observable<BaseNetworkResponse<RefundInfoBean>>

    @GET
    fun getRefundReason(@retrofit2.http.Url requestUrl: String): Observable<BaseNetworkResponse<ArrayList<RefundReasonBean>>>

    @GET
    fun getFreight(@retrofit2.http.Url requestUrl: String, @Query("data_json")data_json: String): Observable<BaseNetworkResponse<FreightBean>>

    @GET
    fun getLogistics(@retrofit2.http.Url requestUrl: String, @QueryMap map: Map<String, String>): Observable<BaseNetworkResponse<ArrayList<LogisticsBean>>>

    @FormUrlEncoded
    @POST
    fun pay(@retrofit2.http.Url requestUrl: String, @FieldMap goodsMap: Map<String, String>): Observable<BaseNetworkResponse<OrderSuccessBean>>

    @GET
    fun getArticle(@retrofit2.http.Url requestUrl: String, @Query("get_type")get_type: Int, @Query("article_type")article_type: Int): Observable<BaseNetworkResponse<ArrayList<ArticleBean>>>

    @FormUrlEncoded
    @POST
    fun uploadImg(@retrofit2.http.Url requestUrl: String, @FieldMap customImg: Map<String, String>): Observable<BaseNetworkResponse<BaseEntity>>

    @GET
    fun wxPay(@retrofit2.http.Url requestUrl: String, @Query("order_id")order_id: String): Observable<BaseNetworkResponse<WxPayParamsBean>>

    @GET
    fun aliPay(@retrofit2.http.Url requestUrl: String, @Query("order_id")order_id: String): Observable<BaseNetworkResponse<String>>

    @GET
    fun appUpdate(@retrofit2.http.Url requestUrl: String): Observable<BaseNetworkResponse<AppUpdateBean>>

    @POST
    fun upLoadPic(@retrofit2.http.Url requestUrl: String, @Body request: RequestBody): Observable<BaseNetworkResponse<Void>>

    @GET
    fun getUpLoadedPic(@retrofit2.http.Url requestUrl: String, @Query("order_id")order_id: String, @Query("goods_id")goods_id: String): Observable<BaseNetworkResponse<ArrayList<String>>>

}